import React from 'react'
import PropTypes from 'prop-types'
import { withStyles } from 'material-ui/styles'
import CommentItem from './comment_item'
import style from './styles'

const Comments = (props) => {
  const { comments, replyCount } = props
  return (
    <div className={props.classes.comments}>
      <div className={props.classes.header}>
        {replyCount}回复
      </div>
      { comments.map((item, index) => (
        <CommentItem comment={item} floor={index} key={item.id} />
        ))
      }
    </div>
  )
}
export default withStyles(style)(Comments)

Comments.propTypes = {
  classes: PropTypes.objectOf(Object),
  comments: PropTypes.objectOf(Object),
  replyCount: PropTypes.number,
}
